package io.sxl.modules.generator.service.impl;

import io.sxl.modules.generator.dao.HouseDao;
import io.sxl.modules.generator.entity.HouseEntity;
import io.sxl.modules.generator.entityx.DiaoBoEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class DiaoboService {
    @Resource
    private HouseDao dao;

    public String diaobo(DiaoBoEntity entity) {

        Integer key = entity.getKey();

        List<HouseEntity> house = entity.getId();

        List<Integer> ids = new ArrayList<>();

        house.forEach(id->ids.add(id.getId()));

        Boolean diaobo = dao.diaobo(key,ids);

        return "ok";
    }




    public Boolean fenpei(Map<String, Object> params) {
        String hostid =(String) params.get("hostid");
        String familyId=(String)params.get("familyId");
        return dao.fenpei(Integer.parseInt(hostid),Integer.parseInt(familyId));
    }
}
